import 'package:flutter/material.dart';

import '../../../../helper/utils/util.dart';

/// hello
class MeansCell extends StatelessWidget {
  const MeansCell({
    Key? key,
    required this.md,
  }) : super(key: key);
  final dynamic md;
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        // Get.toNamed(RouterPath.means_detail, arguments: md);
      },
      child: Container(
        padding: EdgeInsets.symmetric(
          horizontal: 12.r,
          vertical: 10.r,
        ),
        color: Colors.white,
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            loadImage(url: 'file.png'.imgPathCommon, width: 40.r),
            SizedBox(
              width: 8.r,
            ),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    md.documentTitle ?? '',
                    style: TextStyle(
                      color: ColorsUtil.title,
                      fontWeight: FontWeight.w600,
                      fontSize: 14.sp,
                    ),
                  ),
                  SizedBox(
                    height: 5.r,
                  ),
                  Row(
                    // mainAxisAlignment: Main,
                    children: [
                      Text(
                        md.publishTime?.split(' ').first ?? '',
                        style: TextStyle(
                          color: ColorsUtil.content,
                          fontSize: 12.sp,
                        ),
                      ),
                      SizedBox(
                        width: 10.r,
                      ),
                      Text(
                        md.riskLevel ?? '',
                        style: TextStyle(
                          color: riskColor(),
                          fontSize: 13.sp,
                        ),
                      ),
                    ],
                  )
                ],
              ),
            ),
            Icon(
              IconUtil.arrow_right,
              color: Colors.grey[400],
              size: 13.r,
            ),
          ],
        ),
      ),
    );
  }

  Color riskColor() {
    if (md.riskLevel == '高风险') {
      return Colors.red;
    }

    if (md.riskLevel == '低风险') {
      return Colors.amber;
    }

    if (md.riskLevel == '高风险') {
      return Colors.blue;
    }
    return Colors.blue;
  }
}
